home *** CD-ROM | disk | FTP | other *** search
- /* Plot.h by Jonas Karlsson, July 1990
- *
- * Copyright (C) 1991 The Board of Trustees of
- * The Leland Stanford Junior University. All Rights Reserved.
- */
-
- #define PLOT_H_ID "$Id: Plot.h,v 1.13 1992/04/22 00:22:27 pfkeb Rel $"
-
- #import <objc/hashtable.h>
- #import "hippo.h"
- #import "Graphic.h"
-
- struct cutParmType
- {
- char *cutFunc;
- int varIndex;
- float cutValue1;
- float cutValue2;
- int cutCode;
- int blkSize;
- };
- typedef struct cutParmType cutParmType;
-
- typedef struct cutStorElem_t {
- id plot;
- NXAtom name;
- func_id function;
- } cutStorElem;
-
- typedef struct dependStorElem_t {
- id plot;
- NXAtom name;
- } dependStorElem;
-
- @interface Plot:Graphic
- {
- id graphicView; /* The View object in which drawing is done */
- id hTuple; /* HTuple object for ntuple bound to display */
- display disp;
- BOOL cutHistFlag;
- char *reffilename; /* filename of tuple referenced */
- int ntindex; /* index to n-tuple in file */
- BOOL refFlag; /* reference state before archiving */
- BOOL fixBinsFlag; /* fixed bins state before archiving */
- NXAtom uniqueName; /* unique name of plot */
-
- /* data on plots used to make cut on this plot */
- id cutPlotStor; /* Storage for cut Plots and func.*/
- id cutPlotList; /* temporary List of cut Plots */
-
- /* data used by Plot used for a Cut */
- id dependStor; /* List of dependent Plots */
- id dependList; /* temporary List of dependent Plots */
- cutParmType cutParms;
- int cutNumber; /* No longer used, but archived */
- }
-
-
- + initialize;
- /*
- * Class initializer. Sets version number of Class.
- */
-
- - init;
-
- - (const char *)name;
- /*
- * Retruns the unique name for the receiving object
- */
-
- - setGraphicView:anObject;
- /*
- * Sets the graphic View object of the receiver.
- */
-
- - graphicView;
- /*
- * Returns the view that receiving object is being displayed in.
- */
- - setHTuple: ht withDisplay:(display) d1;
- /* Sets the ntuple handler and display hippo structures */
-
- - setRefFilename:(const char *)filename;
- /*
- * Sets the name of the reference n-tuple file
- */
-
- - changeRefFileNameIfValid:(const char *)filename;
- /*
- * Change the reference file name if it is a valid change. A
- * valid change is one in which the n-tuple for the plot did not
- * come from a file, i.e. it either came from pasteboard or from
- * another part of the application.
- */
-
- - getDispType:(graphtype_t *) type;
- - setDispType:(graphtype_t *) type;
-
- - closeTuple;
- /*
- * Un-binds the display from the n-tuple.
- */
-
- - bindReference;
- /*
- * Attempts to bind the plot and its display to ntuple using its archived
- * reference filename. This method is used for inserting a plot
- * when reading document or when pasting from PasteBoard.
- */
-
- - bindCuts;
- /*
- * Attempts to bind the plot with its cuts, or its cut dependents.
- * Should be invoked only after all plots have been bound.
- */
-
- - setRefFlag:(BOOL) refFlag;
- /*
- * Sets state of display's ntuple reference
- */
-
- - setFixBinsFlag:(BOOL)flag;
- /*
- * Sets the fixed bins flag.
- */
-
- - replaceTupleWith: ht;
- /* Replaces the tuple handler of the display with new handler n1.
- */
-
- - replace:oldTuple with:newTuple;
- /*
- * If oldTuple is the HTuple object for receiving Plot, then it
- * is replaced with newTuple. returns self;
- */
-
- - hTuple;
- /*
- * Returns the n-tuple handler object for display.
- */
-
- - (ntuple) ntuple;
- /* Returns the ntuple */
-
- - addHTupleToList:tlist;
- /*
- * Adds the receiving object's hTuple to list tlist.
- */
-
- - addPlotToList:list;
- /*
- * Receiving plot adds itself to the List list.
- */
-
- - (display) histDisplay;
- /* Returns the Hippo display */
-
- - NameAxisX:(const char *)AxisName;
- - NameAxisY:(const char *)AxisName;
- - NameAxisW:(const char *)AxisName;
- - NameAxisXE:(const char *)AxisName;
- - NameAxisYE:(const char *)AxisName;
- /*
- * Set the label of the axes.
- */
-
- - (const char *) axisLabelX;
- /*
- * Returns the x-axis label
- */
-
- - (const char *) axisLabelY;
- /*
- * Returns the y-axis label
- */
-
- - bindAxisX:(int *)dataDim;
- /* Binds the X axis to data dimension dataDim.
- */
-
- - bindAxisY:(int *)dataDim;
- /* Binds the Y axis to data dimension dataDim.
- */
-
- - bindAxisW:(int *)dataDim;
- /* Binds the weight to data dimension dataDim.
- */
-
- - bindAxisXE:(int *)dataDim;
- /* Binds the X error to data dimension dataDim.
- */
-
- - bindAxisYE:(int *)dataDim;
- /* Binds the Y error to data dimension dataDim.
- */
-
- - setLogScaleX:(int *)yesOrNo;
- - (BOOL) isLogScaleX;
- /*
- * Returns YES if x-axis is display a log scale.
- */
-
- - setLogScaleY:(int *)yesOrNo;
- /* sets log scale for this display */
-
- - (BOOL) isLogScaleY;
- /*
- * Returns YES if x-axis is display a log scale.
- */
-
- - setAutoScaleX:(int *)yesOrNo;
- - setAutoScaleY:(int *)yesOrNo;
-
- - setTitlesFlag:(int *)yesOrNo;
- /*
- * Sets titles and labels drawing on or off
- */
-
- - (int) titlesFlag;
- /*
- * Returns YES if titles and labels are being drawn
- */
-
- - setAxesFlag:(int *)yesOrNo;
- /*
- * Sets drawing of axes on or off
- */
-
- - (int) axesFlag;
- /*
- * Returns YES if axes are being drawn.
- */
-
- - setCutHistFlag: (BOOL) yesOrNo;
- /*
- * Shows type of this plot. If it is a Cut Histogram, we handle it differently
- */
-
- - (BOOL) isCutHist;
- /* returns YES or NO */
-
- - setNumBinsForAxisX:(int *) n;
- /*
- * Changes the number of bins for axis X to n bins
- */
-
- - setNumBinsForAxisY:(int *) n;
- /*
- * Changes the number of bins for axis Y to n bins
- */
- - (int) numBinsForAxis:(binding_t) axis;
- - (float) widthForAxis:(binding_t) axis;
- - setRangeForAxisX:(NXPoint *)p;
- - getRangeForAxisX:(NXPoint *)p;
- - setRangeForAxisY:(NXPoint *)p;
- - getRangeForAxisY:(NXPoint *)p;
- - getRangeForAxisY:(NXPoint *)p normalizedTo:plot;
- /*
- * Returns, by reference, the range of the y axis. If both the receiving
- * plot and plot are of graphtype HISTOGRAM, the the returned range
- * is normalized to take into account the bin width.
- */
-
- - getRangeForAxis:(binding_t) axis low:(float *) xl high:(float *) xh;
- - setRangesFrom:plot;
- /*
- * Receiving plot sets x and y ranges to correspond to those of plot.
- * If bot plots are graphtype HISTOGRAM, then receiving plot will
- * take into account the bin width
- */
- - setDrawType:(drawtype_t *) type;
- - getDrawType:(drawtype_t *) type;
- - setColorType:(int *) onOff;
- - (char *) title;
- /* Returns the title of the Histogram display
- */
-
- - print;
- /* Generates line printer output to stdout
- */
-
- - draw;
- - setBounds:(const NXRect *)aRect;
- - sizeToNaturalAspectRatio;
- /*
- * Sets size to default plot size keeping the upper left corner
- * at its current postion.
- */
- /* Methods supporting managing cutPlots to this plot */
- - addCutPlot: cutPlot;
- /*
- * Adds a plot being used to display cuts to list of cut plots
- */
-
- - changeCutPlot:cutPlot;
- /*
- * Informs receiving Plot that the plot cutPlot has changed the
- * cut function parameters.
- */
-
- - removeCutPlot:cutPlot;
- /*
- * Receiving Plot removes cutPlot from list of plots that apply
- * cut to its display.
- */
-
- - removeAllCuts;
- /*
- * Receiving Plot removes all cuts.
- */
-
- - cutList;
- /*
- * Returns the list of plots being used to display the cuts on the
- * receiving object.
- */
-
- - (BOOL) hasCut;
- /*
- * Returns YES if a cut is being applied to the display
- */
-
- /* Methods used to support plot being used for display for a cut function */
- - setCutParms:(cutParmType *) parms;
- /*
- * Sets the cut parameters for Plot being used to display cut function.
- */
-
- - getCutParms:(cutParmType *) parms;
- /*
- * Returns the cut parameters for cut functions being displayed by
- * receiving object.
- */
-
- - addCutDepend:sender;
- /*
- * Receiving object adds sender to list of Plots that depends
- * on its cut control.
- */
-
- - removeCutDepend:sender;
- /*
- * Removes the sender from list of Plots depending on receiver's
- * cut control.
- */
-
- - (unsigned) dependCount;
- /*
- * Returns the number of Plot objects depending on the receiving
- * object to control its cut
- */
-
- - dependList;
- /*
- * Returns a List object containing those Plots that depend on
- * receiving objects cut paramaters.
- */
-
- - (BOOL) isCutPlot;
- /*
- * Returns YES if receiving Plot is a plot that displays a cut,
- * NO otherwise.
- */
-
- /* Methods supporting Archiving and de-Archiving */
- - write:(NXTypedStream *) ts;
- - read:(NXTypedStream *) ts;
- - free;
- /* frees the Hippo display (but not the tuple) and frees itself
- */
-
- @end
-